An editor is a computer application that allows a user to alter the contents of a file. Typically, editors operate on plain text files, which only include ASCII characters, and provide functionality that facilitate in the altering of the contents of the plain text files. One such functionality is the undo/redo capability included in most editors. In its simplest form, an undo/redo tool allows the user to undo a single change and then, if requested, redo that single change.
More sophisticated editors track a large number of modifications in a history and allow the user to undo and redo any of the modifications in the history. Further, most editors group certain modifications together, such as continuous typing, so that the group can be undone in a single transaction.
Specialized editors also exist that are targeted at a specific type of plain text file such as source code, HyperText Markup Language (HTML), or Extensible Markup Language (XML). Due to the structure and/or restricted grammar of these plain text files, specialized editors can provide tools such as syntax highlighting and auto-completion. Further, markup languages like HTML and XML store additional information in the form of tags as well as text. In the case of HTML, the extra information contained in the tags can be used to render the text into a graphical presentation format. In the case of XML, the extra information contained in the tags can be used to render the text into a hierarchical presentation format. Some HTML and XML editors allow altering of the underlying text in a plain text file through both a standard text interface showing the text and an interface that shows the alternative presentation format (i.e., graphical presentation format or hierarchical presentation format).
Editors that allow modifications to be made in multiple presentation formats can be described as mixed model editors. Mixed model editors, like standard text editors, provide undo/redo capabilities; however, mixed model editors face an additional hurdle in that modifications must be tracked in multiple models. Further, modifications made in a first model (e.g., a text model) may not correspond to a valid modification in a second model (e.g., a graphical model). For example, modifying the text in an HTML file may result in malformed HTML that cannot be rendered in the graphical presentation format, resulting in a broken model.
In general, one of two approaches is used in mixed model editors to deal with broken models. The first approach is to delete any stored modifications whenever the editor switches from a first model to a second model. The second approach is to display a message stating that the model is broken until the user manually makes modifications resulting in valid text that can be parsed by the second model.